<!DOCTYPE html>
<html class="login-bg">
<head>
	<title>NexHome</title>
    
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
    <!-- bootstrap -->
    <link href="css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="css/layout.css" />
    <link rel="stylesheet" type="text/css" href="css/elements.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />

    <!-- libraries -->
    <link rel="stylesheet" type="text/css" href="css/lib/font-awesome.css" />
    
    <!-- this page specific styles -->
    <link rel="stylesheet" href="css/compiled/signin.css" type="text/css" media="screen" />

     <!-- open sans font -->
    <link href='css/OpenSans.css' rel='stylesheet' type='text/css' />

    <!-- lato font -->
    <link href='css/Lato.css' rel='stylesheet' type='text/css' />
	
<!--[if lt IE 9]>
      <script src="js/html5.js"></script>
    <![endif]-->  
	   
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>

    <div class="row-fluid login-wrapper" id="LoginDiv" style="display:none">
        <a href="index.html">
            <img class="logo" src="img/logo.png" />
        </a>

        <div class="span4 box">
		<form id="loginform" name="loginform"  action="#" class="form form-login" autocomplete="off"> 
            <div class="content-wrap">
                <h6>工程商自助管理系统</h6>
                <input class="span12" id="userName" type="text" placeholder="用户名" />
                <input class="span12" id="password" type="password" placeholder="密码" />
                <!--<a href="#" class="forgot">Forgot password?</a>
                <div class="remember">
                    <input id="remember-me" type="checkbox" />
                    <label for="remember-me">Remember me</label>
                </div>-->
                <button type="submit" class="btn-glow primary login"   id="btnRtSubmit">登录</button>
            </div>
			</form>
        </div>

        <div class="span4 no-account" style="display:none">
            <p>Don't have an account?</p>
            <a href="signup.html">Sign up</a>
        </div>
    </div>
	<div class="row-fluid login-wrapper" id="IEErrorDiv" style="display:none">
        <a href="index.html">
            <img class="logo" src="img/logo.png" />
        </a>

        <div class="span4 box">
            <div class="content-wrap">
                <h6>对不起，该管理系统暂不支持IE6~9浏览器，请使用谷歌，火狐或IE 10以上版本的浏览器</h6>
                
            </div>
        </div>

       
    </div>
	<!-- scripts -->
	<script src="js/jquery-1.10.2.min.js"></script>
    <script src="js/jquery-latest.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/theme.js"></script>
	<script src="js/bootbox.min.js"></script>

    <!-- pre load bg imgs -->
    <script type="text/javascript">

function myKeyDown(e) {
    e= (window.event)? event : e;
    var intKey = 0;
    intKey = (e.keyCode)? e.keyCode: e.charCode;
    if(intKey == 13)
    {
        //onlogin();
        return intKey;
    }
	return 0;
}
function Btnaply(){
  var name = $("#userName").val();
  var pswd = $("#password").val();
  if(name == '')
  {
  	
	bootbox.alert('请输入用户名', function() {					
						return;
	});
	return;
  }
  $( '#btnRtSubmit' ).trigger( 'wait' );
    $.ajax({                 
				  
                url:'../common/auth/orgAdminLogin',
				type: 'GET',  
                dataType: 'json',
				timeout: 10000,                 
                cache: false,
				data:{account: name,password: pswd},                
				error : function() {
					alert("登录连接超时...");				
				},    
                success: function(data){	               
					
					if(data.resultCode != '10000'){
						bootbox.alert(data.resultMsg, function() {
						$( '#btnRtSubmit' ).trigger( 'done' );					
						return;
						});						
					}
					else{
	                   window.location.href = "index.html";
					}
				}
            });
  }
  
$(function () {
	$("html").css("background-image", "url('img/bgs/8.jpg')");
	if (!$.support.leadingWhitespace){
    // 此浏览器为 IE
		$('#IEErrorDiv').show();
		$('#LoginDiv').hide();
	}
	else{
		$('#IEErrorDiv').hide();
		$('#LoginDiv').show();
	} 
     document.onkeydown = myKeyDown;
	 $( '#password' ).on( 'keypress', function( e ) {
	 });
    $( '#btnRtSubmit' ).on( 'wait', function( e ) {
        $(this).removeClass("primary");
        this.disabled = true;		
        $(this).text('登录中...');
		
       
    });

    $( '#btnRtSubmit' ).on( 'done', function( e ) {
         $(this).addClass("primary");
        this.disabled = false;
        $(this).text('登录');
		$( '#userName' ).val('').focus();       
        $( '#password' ).val('').focus();
    }); 
	
	$( '#loginform' ).on( 'submit', function(e) {
	 e.preventDefault(); 
	 var name = $("#userName").val();
  var pswd = $("#password").val();
  if(name == '')
  {
  	
	bootbox.alert('请输入用户名', function() {					
						return;
	});
	return;
  }
  $( '#btnRtSubmit' ).trigger( 'wait' );
    $.ajax({                 
				  
                url:'../common/auth/orgAdminLogin',
				type: 'GET',  
                dataType: 'json',
				timeout: 10000,                 
                cache: false,
				data:{account: name,password: pswd},                
				error : function() {
					alert("登录连接超时...");				
				},    
                success: function(data){	               
					
					if(data.resultCode != '10000'){
						bootbox.alert(data.resultMsg, function() {
						$( '#btnRtSubmit' ).trigger( 'done' );					
						return;
						});						
					}
					else{
	                   window.location.href = "index.html";
					}
				}
      });
 })      

});
    </script>

</body>
</html>